/*
	BallModel
	The object for the ball which will be the player.
	
	possible args:
	radius:double
	latNum:int
	lonNum:int
*/
function BallModel (){
    setDefaults(this);
    this.radius = 1.5;
	var latNum = 50;
	var lonNum = 50;

    this.color = [2.0, 1.0, 3.0, 1.0];
	
	this.create = function(){
		for(var lat = 0; lat < latNum; lat++){
			var theta = lat * Math.PI / latNum;
			var sinTheta = Math.sin(theta);
			var cosTheta = Math.cos(theta);
			
			var theta1 = (lat + 1) * Math.PI / latNum;
			var sinTheta1 = Math.sin(theta1);
			var cosTheta1 = Math.cos(theta1);

			for(var lon = 0; lon < lonNum; lon++){
				var phi = lon * 2 * Math.PI / lonNum;
				var sinPhi = Math.sin(phi);
				var cosPhi = Math.cos(phi);

				var x = cosPhi * sinTheta;
				var y = cosTheta;
				var z = sinPhi * sinTheta;
				var x1 = cosPhi * sinTheta1;
				var y1 = cosTheta1;
				var z1 = sinPhi * sinTheta1;

				this.normalData.push(x);
				this.normalData.push(y);
				this.normalData.push(z);
				this.vertexData.push(this.radius * x);
				this.vertexData.push(this.radius * y);
				this.vertexData.push(this.radius * z);
				
				
				this.normalData.push(x1);
				this.normalData.push(y1);
				this.normalData.push(z1);
				this.vertexData.push(this.radius * x1);
				this.vertexData.push(this.radius * y1);
				this.vertexData.push(this.radius * z1);
			}
		}
	}

    this.draw = function(camera) {
        this.prepareDraw(camera);
        gl.drawArrays(gl.TRIANGLE_STRIP, 0, this.vertexBuffer.numItems);
    }
}
